<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- 插槽：内容分发 -->
    <!-- 作用和自定义属性非常接近,也可以做父传子 -->

    <!-- 插槽不仅可以传入js变量，还可以插入标签甚至组件 -->

    <!-- 在谁的template里面就用谁的变量 -->
    <div id="app">
      <h2>插槽</h2>
      <child>123123123123123</child>
      <child>hello</child>
      <child>{{ count }}</child>
      <child><i>hello 插槽</i></child>
      <child><child2></child2></child>
    </div>

    <script src="./lib/Vue3.js"></script>
    <script>
      const { createApp } = Vue;

      const Child2 = {
        template: `
          <span style="color: red;">child2组件22222</span>
        `,
      };

      const Child = {
        // outerHTML
        template: `
          <div><slot></slot> - child子组件 - <slot></slot></div>
        `,
      };

      createApp({
        data() {
          return {
            count: 1,
          };
        },
        components: {
          Child,
          Child2,
        },
      }).mount("#app");
    </script>
  </body>
</html>
